package net.finnigin.process;

import java.io.InputStream;

public class BufferedGobbler extends InputStreamGobbler {
	protected StringBuilder buffer;

	/**
	 * 
	 */
	public BufferedGobbler() {
		super();
		buffer = new StringBuilder();
	}

	/**
	 * @param inputStream
	 * @param startGobbling
	 */
	public BufferedGobbler(InputStream inputStream, boolean startGobbling) {
		super(inputStream, false);
		buffer = new StringBuilder();
		if (startGobbling)
			this.startGobbling();
	}

	@Override
	protected void processByte(int thebyte) {
		buffer.append((char) thebyte);
	}

	public String getGobbled() {
		return buffer.toString();
	}

	@Override
	public String toString() {
		return buffer.toString();
	}
}
